package com.rock.code.common.comm;

import org.apache.commons.codec.binary.Base64;

public class DesEncrypterIsmp {

    public static String encrypt(String pw) {
        try {
            return new String(Base64.encodeBase64(pw.getBytes("UTF-8")), "UTF-8");
        } catch (Exception e) {
            return null;
        }
    }

    public static String decrypt(String pw) {
        try {
            return new String(Base64.decodeBase64(pw), "UTF8");
        } catch (Exception e) {
            return null;
        }
    }
    
    public static void main(String[] args) {
        String str1 = new DesEncrypterIsmp().decrypt("MTMzOTE1NzE3Njc=");
        String str2 = new DesEncrypterIsmp().encrypt("admin");
        System.out.println(str1);
        System.out.println(str2);

    }
}
